﻿@{
    Layout = null;
}

<script type="text/javascript">
    $(document).ready(function () {
        $("#userForm").validate({
            rules: {
                txt_realname: { required: true },
                txt_tel: { required: true },
                txt_mail: { required: true, email: true }
            },

            messages: {
                txt_realname: { required: "请输入姓名" },
                txt_tel: { required: "请输入电话号码" },
                txt_mail: { required: "请输入Email地址", email: "请输入一个合法的Email地址" }
            }
        });

        $("#passwordForm").validate({
            rules: {
                old_password: { required: true, maxlength: 16, minlength: 6 },
                new_password: { required: true, maxlength: 16, minlength: 6 },
                comfirm_password: { required: true, equalTo: "#new_password" }
            },

            messages: {
                old_password: { required: "请输入原始密码", maxlength: "密码长度不能大于16位", minlength: "密码长度不能少于6位" },
                new_password: { required: "请输入新密码", maxlength: "密码长度不能大于16位", minlength: "密码长度不能少于6位" },
                comfirm_password: { required: "请输入确认密码", equalTo: "两次密码不一致" }
            }
        });
    });
</script>
@model EC_System.Models.CustomerData
<div class="AreaR2">
    <div class="box">
        <div class="box_1">
            <div class="userCenterBox boxCenterList clearfix" style="_height:1%;">

                <h5><span>个人资料</span></h5>
                <div class="blank"></div>
                
                @using (Html.BeginForm("EditUserInfo", "UserCenter", FormMethod.Post, new { name = "userForm", id = "userForm" }))
                {
                    @Html.AntiForgeryToken();
                    <table width="100%" border="0" cellpadding="5" cellspacing="5">

                        <tr>
                            <td width="28%" align="right" bgcolor="#FFFFFF">真实姓名：</td>
                            <td width="72%" align="left" bgcolor="#FFFFFF">
                                <input id="txt_realname" name="txt_realname" type="text" class="inputBg required" value="@Model.RealName" maxlength="10" /><span style="color:#FF0000"> *</span>
                            </td>
                        </tr>

                        <tr>
                            <td width="28%" align="right" bgcolor="#FFFFFF">出生日期： </td>
                            <td width="72%" align="left" bgcolor="#FFFFFF">
                                <select name="birthdayYear">
                                    @for (int i = 1970; i <= 2020; i++)
                                    {
                                        <option value=@i @{string select = i == Model.Birthday.Year ? "selected" : ""; @select            }> @i</option>
    }
                                </select>&nbsp;
                                <select name="birthdayMonth">
                                    @for (int i = 01; i <= 12; i++)
                                    {
                                        <option value=@i @{string select = i == Model.Birthday.Month ? "selected" : ""; @select             }> @i</option>
    }
                                </select>&nbsp;
                                <select name="birthdayDay">
                                    @for (int i = 01; i <= 31; i++)
                                    {
                                        <option value=@i @{string select = i == Model.Birthday.Day ? "selected" : ""; @select              }> @i</option>
    }
                                </select> 填生日有惊喜哦！
                            </td>
                        </tr>

                        <tr>
                            <td width="28%" align="right" bgcolor="#FFFFFF">性　别： </td>
                            <td width="72%" align="left" bgcolor="#FFFFFF">
                                @if (string.IsNullOrWhiteSpace(Model.Sex) || Model.Sex.Equals("保密"))
                                {
                                    <input type="radio" name="rdo_Sex" value="保密" checked="checked" /><span>保密 &nbsp;&nbsp;</span>
                                    <input type="radio" name="rdo_Sex" value="男" /><span>男 &nbsp;&nbsp;</span>
                                    <input type="radio" name="rdo_Sex" value="女" /><span>女 &nbsp;&nbsp;</span>
                                }
                                else if (Model.Sex.Equals("男"))
                                {
                                    <input type="radio" name="rdo_Sex" value="保密" /><span>保密&nbsp;&nbsp;</span>
                                    <input type="radio" name="rdo_Sex" value="男" checked="checked" /><span>男&nbsp;&nbsp;</span>
                                    <input type="radio" name="rdo_Sex" value="女" /><span>女&nbsp;&nbsp;</span>
                                }
                                else if (Model.Sex.Equals("女"))
                                {
                                    <input type="radio" name="rdo_Sex" value="保密" /><span>保密 &nbsp; &nbsp;</span>
                                    <input type="radio" name="rdo_Sex" value="男" /><span>男 &nbsp; &nbsp;</span>
                                    <input type="radio" name="rdo_Sex" value="女" checked="checked" /><span>女 &nbsp; &nbsp;</span>
                                }


                            </td>
                        </tr>
                        <tr>
                            <td width="28%" align="right" bgcolor="#FFFFFF">联系电话：</td>
                            <td width="72%" align="left" bgcolor="#FFFFFF"><input name="txt_tel" type="text" class="inputBg required" value="@Model.Tel" maxlength="20" /><span style="color:#FF0000"> *</span></td>
                        </tr>
                        <tr>
                            <td width="28%" align="right" bgcolor="#FFFFFF">电子邮件地址： </td>
                            <td width="72%" align="left" bgcolor="#FFFFFF"><input name="txt_mail" type="text" class="inputBg required email" value="@Model.Email" size="25" maxlength="50" /><span style="color:#FF0000"> *</span></td>
                        </tr>

                        <tr>
                            <td width="28%" align="right" bgcolor="#FFFFFF">QQ：</td>
                            <td width="72%" align="left" bgcolor="#FFFFFF"><input name="txt_qq" type="text" class="inputBg" value="@Model.QQ" maxlength="15" /></td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center" bgcolor="#FFFFFF">
                                <input name="act" type="hidden" value="act_edit_profile" />
                                <input name="submit" type="submit" value="确认修改" class="bnt_blue_1" style="border:none;" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center" bgcolor="#FFFFFF">
                                <span style="color:red;">@TempData["Message"]</span>
                            </td>
                        </tr>
                    </table>
    }
                @using (Html.BeginForm("EditUserPassword", "UserCenter", FormMethod.Post, new { name = "passwordForm", id = "passwordForm" }))
                {
                    @Html.AntiForgeryToken();
                    <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#ffffff">
                        <tr>
                            <td width="28%" align="right" bgcolor="#FFFFFF">原密码：</td>
                            <td width="76%" align="left" bgcolor="#FFFFFF">
                                <input name="old_password" type="password" size="25" class="inputBg required maxlength minlength" /><span style="color:#FF0000"> *</span>
                            </td>
                        </tr>
                        <tr>
                            <td width="28%" align="right" bgcolor="#FFFFFF">新密码：</td>
                            <td align="left" bgcolor="#FFFFFF">
                                <input name="new_password" id="new_password" type="password" size="25" class="inputBg required maxlength minlength" /><span style="color:#FF0000"> *</span>
                            </td>
                        </tr>
                        <tr>
                            <td width="28%" align="right" bgcolor="#FFFFFF">确认密码：</td>
                            <td align="left" bgcolor="#FFFFFF">
                                <input name="comfirm_password" type="password" size="25" class="inputBg required equalTo" /><span style="color:#FF0000"> *</span>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center" bgcolor="#FFFFFF">
                                <input name="submit" type="submit" class="bnt_blue_1" style="border:none;" value="确认修改" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center" bgcolor="#FFFFFF">
                                <span style="color:red;">@TempData["Message"]</span>
                            </td>
                        </tr>
                    </table>
                }
                @if (!string.IsNullOrWhiteSpace(ViewBag.CodeErr))
                {
                    <script type="text/javascript">alert("修改失败，请重新输入！")</script>
                }
            </div>
        </div>
    </div>
</div>
<div class="blank"></div>